<?php
namespace App\Services;


use Ixudra\Curl\Facades\Curl;

/**
 * 高德地图 todo 以后有时间封装
 * Class PassengerAmapService
 * @package App\Services
 */
class PassengerAmapService extends BaseService
{


    /**
     * 获取开车路线
     * @param $data
     */
    public function getDriveRoute($data)
    {
        $data['key'] = env('AMAP_WEB_KEY');
        $url = 'restapi.amap.com/v3/direction/driving';
        $response = Curl::to($url)->withData($data)->get();
        $response = json_decode($response, true);
        if($response['status'] != 1)
            return_bob($response['info'], 0, 200);

        return $response['route'];
    }


}
